package vip.sweet.sys.modular.user.entity;

import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonIgnore;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import vip.sweet.common.entity.CommonEntity;
import vip.sweet.sys.modular.user.enums.SexEnum;

/**
 * @author tianlianyin
 * @date 2024/11/9
 */
@EqualsAndHashCode(callSuper = true)
@Data
@AllArgsConstructor
@NoArgsConstructor
@TableName("sys_user")
@Schema(description = "用户实体类")
public class User extends CommonEntity {
    @Schema(description = "用户名")
    private String username;
    @Schema(description = "密码")
    @JsonIgnore
    private String password;
    @Schema(description = "昵称")
    private String nickname;
    @Schema(description = "头像")
    private String avatar;
    @Schema(description = "邮箱")
    private String email;
    @Schema(description = "手机号")
    private String phone;
    @Schema(description = "性别")
    private Integer gender;
//    @Trans(type = TransType.ENUM,key = "sex")
    @TableField(exist = false)
    private String sex;
    @Schema(description = "部门id")
    private String departmentId;
    @Schema(description = "部门名称")
    private String departmentName;
    public String getSex() {
        if (this.gender == null)
            return null;
        return SexEnum.getName(this.gender);
    }
}
